🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / testing / src / commonMain / kotlin / org / meshtastic / core / testing / FakeLocationRepository.kt
Displaying Raw • Download
core/testing/src/commonMain/kotlin/org/meshtastic/core/testing/FakeLocationRepository.kt 41414f832f938b655c97bc07509bc140ea16e2a3 (41414f83) Text, 1.83 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.testing
Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787kotlinx.coroutines.flow.MutableSharedFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.MutableStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.core.repository.Location
Tff7b72import T7ee787org.meshtastic.core.repository.LocationRepository
T8b949e/** A test double for [LocationRepository] that provides a manual location emission mechanism. */
Tff7b72class T56d364FakeLocationRepository Tb4b4b4: Te6edf3LocationRepository Tb4b4b4{
Tff7b72private Tff7b72val Te6edf3_receivingLocationUpdates Tff7b72= Te6edf3MutableStateFlowTb4b4b4(Tff7b72falseTb4b4b4)
Tff7b72override Tff7b72val Te6edf3receivingLocationUpdatesTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72> Tff7b72= Te6edf3_receivingLocationUpdates
Tff7b72private Tff7b72val Te6edf3_locations Tff7b72= Te6edf3MutableSharedFlowTff7b72<Te6edf3LocationTff7b72>Tb4b4b4(Te6edf3replay Tff7b72= T79c0ff1Tb4b4b4)
Tff7b72override Tff7b72fun Td2a8ffgetLocationsTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3LocationTff7b72> Tff7b72= Te6edf3_locations
Tff7b72fun Td2a8ffsetReceivingLocationUpdatesTb4b4b4(Te6edf3receivingTb4b4b4: Tffa657BooleanTb4b4b4) Tb4b4b4{
Te6edf3_receivingLocationUpdatesTb4b4b4.Te6edf3value Tff7b72= Te6edf3receiving
Tb4b4b4}
Tff7b72suspend Tff7b72fun Td2a8ffemitLocationTb4b4b4(Te6edf3locationTb4b4b4: Te6edf3LocationTb4b4b4) Tb4b4b4{
Te6edf3_locationsTb4b4b4.Te6edf3emitTb4b4b4(Te6edf3locationTb4b4b4)
Tb4b4b4}
Tb4b4b4}
T8b949e/** Platform-specific factory for creating [Location] objects in tests. */
Tff7b72expect Tff7b72fun Td2a8ffcreateLocationTb4b4b4(Te6edf3latitudeTb4b4b4: Tffa657DoubleTb4b4b4, Te6edf3longitudeTb4b4b4: Tffa657DoubleTb4b4b4, Te6edf3altitudeTb4b4b4: Tffa657Double Tff7b72= T79c0ff0.0Tb4b4b4)Tb4b4b4: Te6edf3Location
Served by rngit 1.5.0 - Generated in 0.04s